package com.googlecode.perfectable.visuable.parse;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Nullable;

import com.googlecode.perfectable.visuable.visual.IdentifiedVisual;

class MapVisualRegistry implements VisualRegistry {
	private final Map<String, IdentifiedVisual> map = new HashMap<>();

	/*
	 * (non-Javadoc)
	 * @see com.googlecode.perfectable.visuable.parse.VisualRegistry#put(java.lang.String,
	 * com.googlecode.perfectable.visuable.visual.StandardVisual)
	 */
	@Override
	public void put(IdentifiedVisual visual) {
		String identifier = visual.identifier();
		this.map.put(identifier, visual);
	}

	/*
	 * (non-Javadoc)
	 * @see com.googlecode.perfectable.visuable.parse.VisualRegistry#get(java.lang.String)
	 */
	@Override
	@Nullable
	public IdentifiedVisual get(String identifier) {
		return this.map.get(identifier);
	}

}
